#!/bin/bash

clear
CACHE_DIR=/home/nginx/cache/
echo "      html htm js css jpg gif png jpeg bmp flv swf ico"
echo -n -e "\e[34;1m 请输入你要删除的缓存文件类型(可以输入多个参数空格隔开)\e[0m\e[34;5m:\e[0m" 
read -a FILE 
for i in `echo ${FILE[*]}|sed 's/ /\n/g'` 
do 
grep -r -a  \.$i ${CACHE_DIR}| awk 'BEGIN {FS=":"} {print $1}'  > /tmp/cache_list.txt 
 for j in `cat /tmp/cache_list.txt` 
do 
   rm  -rf  $j 
   echo "$i  $j 删除成功!" 
 done 
done
